#include "S5Action.h"
#include <KDebug.h>
#include "S5Server.h"

void S5Action::relay(const void *data, size_t length, const KIAddress *dest)
{
    KDebugMsg("Warning: virtual function S5Action::relay() called");
}

S5Server *S5Action::server() const
{
    return static_cast<S5Server *>(item());
}

void S5Action::onPeerRelayed()
{
    server()->receive(socket());
}

void S5Action::onReceived(KKey *&key, void *data, size_t length, bool more)
{
    if (isProxy()) {
        server()->newDownload(length);
    }
}

void S5Action::onSent(KKey *&key, void *data, size_t length)
{
    if (isProxy()) {
        server()->newUpload(length);
    }
}